<script setup>
//搜索页，有路由为search.js专用

import store from "../../store";
import { RouterLink, RouterView } from "vue-router";
store.getStu();
var searchmsg=localStorage.getItem("searchmsg");
console.log(searchmsg)
// var search_form=new FormData();
// search_form.append("searchCont",searchmsg);
store.searchMsg(searchmsg);
var goBack = function() {
  window.location.replace("../Home/Home.html");
};
var searchroom='';
var search=function(){
  window.localStorage.setItem("searchmsg",searchroom);
  store.searchMsg(searchroom)
}

var change = "di1";
</script>

<script>
export default {
  data() {
    return {
      classchange: "di1"
    };
  },
  methods: {
    starttouch(e) {
      e.currentTarget.parentNode.parentNode.children[0].children[0].className =
        "";
      e.currentTarget.parentNode.parentNode.children[1].children[0].className =
        "";
      e.currentTarget.parentNode.parentNode.children[2].children[0].className =
        "";
      e.currentTarget.className += " starttouch";
      console.log("ooook");
    },
    endtouch(e) {
      e.currentTarget.className = "";
    },
    change1() {
      this.classchange = "di1";
      console.log(this.classchange);
    },
    change2() {
      this.classchange = "di2";
      console.log(this.classchange);
    },
    change3() {
      this.classchange = "di3";
      console.log(this.classchange);
    }
  }
};
</script>


<template>
  <div class="main">
    <div class="sousuolan">
      <div class="back" @click="goBack()">
        <svg class="icon" aria-hidden="true">
          <use xlink:href="#icon-left" />
        </svg>
      </div>
      <input type="text" value class="search" v-model="searchroom"/>
      <a href="./search.html" class="sousuo" @click="search()">
        <svg class="icon" aria-hidden="true">
          <use xlink:href="#icon-sousuo" />
        </svg>
      </a>
      <div class="touxiang">
        <img :src="store.state.Stu[0].profile" alt />
      </div>
    </div>
    <div class="fenlei">
      <RouterLink to="./policy">
        <div
          @touchstart="(e)=>{starttouch(e);change1()}"
          @click="(e)=>{starttouch(e);change1()}"
          class="starttouch"
        >政策</div>
      </RouterLink>
      <RouterLink to="./act">
        <div @touchstart="(e)=>{starttouch(e);change2()}" @click="(e)=>{starttouch(e);change2()}">活动</div>
      </RouterLink>
      <RouterLink to="./user">
        <div @touchstart="(e)=>{starttouch(e);change3()}" @click="(e)=>{starttouch(e);change3()}">用户</div>
      </RouterLink>
    </div>
    <div class="di" :class="classchange"></div>
    <RouterView class="rw"></RouterView>
  </div>
</template>


<style scoped>
* {
  padding: 0px;
  margin: 0px;
}

.starttouch {
  color: #f06f9b;
}

.endtouch {
  border-bottom: none;
}

.di {
  transition: 0.2s;
}

.di1 {
  position: fixed;
  top: 84px;
  width: 15.4%;
  height: 2px;
  background-color: #f06f9b;
  z-index: 10;
  left: 9%;
}

.di2 {
  position: fixed;
  top: 84px;
  width: 15.4%;
  height: 2px;
  background-color: #f06f9b;
  z-index: 10;
  left: 42.3%;
}

.di3 {
  position: fixed;
  top: 84px;
  width: 15.4%;
  height: 2px;
  background-color: #f06f9b;
  z-index: 10;
  left: 75.6%;
}

.back {
  position: absolute;
  color: white;
  line-height: 44px;
  padding-left: 10px;
  /* background-color: #fff; */
  padding-right: 10px;
  font-size: 23px;
}

.main {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  /* background-color: #000000; */
  /* background-color: pink; */
  height: 1000px;
}

.rw {
  position: absolute;
  top: 84px;
  z-index: 8;
}

.touxiang {
  position: absolute;
  top: 6px;
  right: 5px;
  width: 30px;
  height: 30px;
  border-radius: 50px;
  overflow: hidden;
}

.touxiang > img {
  width: 100%;
  height: 100%;
}

.fenlei {
  position: fixed;
  border-top: 1px solid #f2f2f2;
  top: 44px;
  width: 100%;
  height: 40px;
  background-color: #fff;
  display: flex;
  justify-content: space-around;
  z-index: 9;
}

.fenlei > a {
  height: 38px;
  line-height: 40px;
  color: #636363;
  /* border-bottom: 2px solid #f06f9b; */
}

a {
  text-decoration: none;
}

.search {
  width: 77%;
  height: 25px;
  color: gray;
  background-color: rgba(252, 252, 252, 0.5);
  padding-left: 7px;
  border-radius: 10px;
  margin-top: 8px;
}
.sousuo {
  position: absolute;
  top: 13px;
  right: 11.6%;
  /* background-color: black; */
  width: 40px;
  height: 19px;
  border-left: 1px solid pink;
  line-height: 19px;
}

.sousuolan {
  position: fixed;
  width: 100%;
  text-align: center;
  /* background-color: rgb(209, 199, 199, 0.5); */
  background-color: #fff;
  height: 44px;
  box-shadow: 0 0 5px #fbfbfb;
  /* border-bottom-left-radius: 5px;
  border-bottom-right-radius: 5px; */
  z-index: 99;
  /* border-bottom: 1px solid pink; */
}

input {
  background: none;
  outline: none;
}
</style>
